<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>{block name="title"} 听雨 {/block}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <link rel="stylesheet" href="/static/index/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/static/index/css/animate.css" />
    <link rel="stylesheet" href="/static/index/css/index.css" />

    <link rel="stylesheet" href="/static/index/css/prism.css" />
    <link rel="stylesheet" href="/static/index/css/typo.css" />
    <style>
        .content{
            max-width: 450px;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-static-top">
    <div class="container">
        <div class="navbar-header">
            <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menu">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="{:url('index/index/index')}" class="navbar-brand">{block name="logo"} 听雨 {/block}</a>
        </div>
        <div class="navbar-menu collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-left">
                <li><a href="{:url('index/index/index')}">首页</a></li>
                {volist name="cates" id="cate"}
                    <li><a href="{:url('index/index/index', ['id' => $cate.id])}">{$cate.catename}</a></li>
                {/volist}

            </ul>
            <ul class="nav navbar-nav navbar-right">
                {if session('?member.id')}
                    <li><a style="color: #f6cf05">{:session('member.nickname')}</a></li>
                    <li><a href="{:url('index/index/logout')}" id="logout">退出</a></li>
                {else/}
                    <li><a href="{:url('index/index/login')}">登录</a></li>
                    <li><a href="{:url('index/index/register')}">注册</a></li>
                {/if}
            </ul>
            <form action="{:url('index/index/search')}" class="navbar-form navbar-right">
                <div class="form-group">
                    <input type="text" class="form-control input-sm" id="search" name="keywords" placeholder="搜索" />
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-default btn-sm">搜索</button>
                </div>
            </form>
        </div>
    </div>
</nav>
<div class="container">
    {block name="content"}

    {/block}
</div>.

{block name="copyright"}
    <div class="footer">
        <p>Copyright 2020<a href="{$websiteInfo.copyright}">&nbsp; ※听雨※ &nbsp;</a> 版权所有</p>
    </div>
{/block}

<script src="/static/index/js/jquery-3.3.1.min.js"></script>
<script src="/static/index/js/bootstrap.min.js"></script>
<!-- layer -->
<script src="/static/lib/layer/layer.js"></script>
<script>
    $("#logout").click(function () {
        $.ajax({
            url: "{:url('index/index/logout')}",
            type: 'post',
            dataType: 'json',
            success: function (data) {
                if (data.code == 1){
                    layer.msg("退出成功", {
                        icon: 6,
                        time: 500
                    }, function () {
                        location.href = data.url;
                    });
                }else {
                    layer.open({
                        title: '退出失败',
                        content: data.msg,
                        icon: 5,
                        anim: 6
                    });
                }
            }
        });

        return false;
    });
</script>

{block name="js"}
{/block}
</body>
</html>